﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using COFE.Core;
using COFE.Core;
using COFE.Core.Profile;
using COFE.Web.NetClient;

namespace COFE.Web
{
    public static class COFEWSShared
    {
        #region Constructor

        #endregion

        #region Methods
        public static void Register()
        {
            if (!(COFEShared.UserProfileManager is WSUserProfileManager))
            {
                if (!(COFEShared.UserProfileManager is IUserProfileManager2))
                    throw new NotSupportedException();

                COFEShared.UserProfileManager = 
                    new WSUserProfileManager(COFEShared.UserProfileManager as IUserProfileManager2);
            }            
        }
        

        #endregion

        #region Data

        private static INetClient _netClient = new HttpNetClient();

        #endregion

        #region Public Properties

        public static INetClient NetClient
        {
            get { return _netClient; }
            set { _netClient = value; }
        }

        public static IUserServiceProfile CurrentUserServiceProfile
        { get { return (COFEShared.UserProfileManager as WSUserProfileManager).CurrentUserServiceProfile; } }

        public static IUserProfileManager2 UserProfileManager
        { get { return COFEShared.UserProfileManager as WSUserProfileManager; } }

        #endregion

    }
}
